import {ref,effectScope} from 'vue'
import {piniaSymbol} from './rootState'
export function createPinia(){
  const scope = effectScope()
  const state = scope.run(()=>ref({}))
  const pinia = {
    _s:new Map(),
    _e:scope,
    install(app){
      app.provide(piniaSymbol,pinia)
      app.config.globalProperties.$pinia = pinia
    },
    state
  }
  return pinia
}